package com.guet.careapp.dao.base;


import com.guet.careapp.utils.PageBean;
import com.guet.careapp.utils.PageQueryModel;

import java.io.Serializable;
import java.util.List;
import java.util.Map;


/**
 * @author LXM
 */
public interface DaoSupport<T> {
    // 增----------------------------

    public Serializable save(T entity) throws Exception;

    public Serializable merge(T entity);

    // 查----------------------------
    public T findById(Integer id);

    public List<T> findAll();

    List<T> findAllByField(Map<String, Object> fieldMap);

    T findByField(Map<String, Object> fieldMap);

    List<T> queryByHql(String hql);

    int getMaxField(String fieldName);

    PageBean queryPageData(PageQueryModel pageQueryModel);

    // PageBean queryPageData(int currentPage, int pageSize);
    // 删----------------------------
    public void deleteById(Integer id) throws Exception;

    public void deleteByField(Map<String, Object> fieldMap) throws Exception;

    public void deleteEnity(T entity);
    // 改----------------------------

    public void update(T entity) throws Exception;

    public void saveOrUpdate(T entity) throws Exception;

    List<T> queryByHQLWithLimit(String hql, int limit) throws Exception;
}
